#include<stdio.h>
int main()
{
	int book[10]={0},temp,zhong=0,n,i;
	int sum=0;
	scanf("%d",&n);getchar();
	for(i=0;i<n;i++)
	{
		scanf("%d",&temp);
		book[temp]++; 
	}
	for(i=0;i<10;i++)
		if(book[i]!=0)
			zhong++;
	for(i=0;i<10;i++)
	{
		if(book[i]==0)
			continue;
		else if(book[i]==1)
			sum+=i*11*(zhong-1);
		else
			sum+=i*11*(zhong);
	}
	printf("%d\n",sum);
	return 0;
}
